
import { type IComponentConfig, ChannelEnum } from '../../types'
import { inputTypes } from '../util'

const props: IComponentConfig[] = [{
  type: 'select',
  component: 'eSelect',
  label: '输入框类型',
  model: 'type',
  props: {
    transfer: true,
    dataSource: {
      type: 'static',
      value: inputTypes
    }
  },
  defaultValue: 'text'
}, {
  type: 'switch',
  component: 'eSwitch',
  label: '是否禁用',
  model: 'disabled',
  defaultValue: false
}, {
  type: 'switch',
  component: 'eSwitch',
  label: '是否可以清空',
  model: 'clearable',
  defaultValue: false
}, {
  type: 'input',
  component: 'eInput',
  label: '占位文本',
  model: 'placeholder',
  defaultValue: '请输入'
}]

const events: IComponentConfig[] = [{
  type: 'codeEditor',
  component: 'CodeEditor',
  model: 'on-enter',
  label: 'onEnter',
  defaultValue: `function fn() {

}
  `
}, {
  type: 'codeEditor',
  component: 'CodeEditor',
  model: 'on-click',
  label: 'onClick',
  defaultValue: `function fn() {

}
  `
}, {
  type: 'codeEditor',
  component: 'CodeEditor',
  model: 'on-search',
  label: 'onSearch',
  defaultValue: `function fn() {

}
  `
}, {
  type: 'codeEditor',
  component: 'CodeEditor',
  model: 'on-clear',
  label: 'onClear',
  defaultValue: `function fn() {

}
  `
}]

const slots: IComponentConfig[] = [{
  type: 'codeEditor',
  component: 'CodeEditor',
  label: 'prepend',
  model: 'prepend',
  defaultValue: `function fn(page, h) {

}
  `
}, {
  type: 'codeEditor',
  component: 'CodeEditor',
  label: 'append',
  model: 'append',
  defaultValue: `function fn(page, h) {

}
  `
}, {
  type: 'codeEditor',
  component: 'CodeEditor',
  label: 'prefix',
  model: 'prefix',
  defaultValue: `function fn(page, h) {

}
  `
}, {
  type: 'codeEditor',
  component: 'CodeEditor',
  label: 'suffix',
  model: 'suffix',
  defaultValue: `function fn(page, h) {

}
  `
}]

const drag = {
  compName: 'eInput',
  label: '文本输入',
  classify: {
    label: '基础',
    value: 'basic'
  },
  channel: ChannelEnum.PC,
  group: {
    label: '表单',
    value: 'form'
  },
  icon: 'icon-text'
}

export default {
  drag,
  props,
  events,
  slots
}
